package googleJam.round1A;

import googleJam.problem.CaseTest;
import utils.MathUtils;

public class SolutionACaseTest extends CaseTest{
	private static final String POSSIBLE = "Possible";
	private static final String BROKEN = "Broken";
	
	private long _todayGameMaxNumber;
	private long _todayGamePercent;
	private long _totalGamePercent;
		
	public SolutionACaseTest (String line,int index, int beginIndex)
	{
		super(line,index,beginIndex);
		String[] splits = line.split(" ");
		_todayGameMaxNumber = Long.valueOf(splits[0]);
		_todayGamePercent = Long.valueOf(splits[1]);
		_totalGamePercent = Long.valueOf(splits[2]);
	}

	@Override
	public String getResult() {
		//write the algorithme here
		if(_todayGameMaxNumber == 0) return BROKEN;
		if ((_todayGamePercent < 100 && _totalGamePercent == 100)) return BROKEN;
		if ((_todayGamePercent > 0 && _totalGamePercent == 0)) return BROKEN;
		
		if ( _todayGamePercent > 0 && _todayGamePercent < 100)
		{
			long pgcd = MathUtils.pgcd(_todayGamePercent, 100 -_todayGamePercent) ;
			if (100/pgcd > _todayGameMaxNumber) return BROKEN;
		}
		return POSSIBLE;
	}
	
	@Override
	public int calculLineNumber() {
		return 1;
	}

	@Override
	public int getEndIndex() {
		return _beginIndex + getEndIndex() - 1;
	}

	@Override
	public void trait(String line, int index) {
		
	}
}
